/*
 * Project: SmartWard
 * Package: com.ruoyi.ichen.base.configs
 * File: AliyunConfig
 * Date: 2020-2-16 16:37
 * Version: V1.0
 * Copyright © 2018 - 2019 YESOFT CHINA, Inc. All Rights Reserved.
 */
package com.ruoyi.ichen.base.configs;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @ClassName: AliyunConfig
 * @Description: 阿里云oss配置
 * @Author chenhuanghua
 * @Date 2020-2-16 16:37
 * @Version V1.0
 */

@Configuration
@PropertySource("classpath:/properties/aliyun.properties")
@ConfigurationProperties(prefix = "aliyun")
@Data
public class AliyunConfig {

    private String endpoint;
    private String accessKeyId;
    private String accessKeySecret;
    private String bucketName;
    private String urlPrefix;

    @Bean
    public OSS oSSClient() {
        System.out.println(endpoint);
        System.out.println(accessKeyId);
        System.out.println(accessKeySecret);
        return new OSSClient(endpoint, accessKeyId, accessKeySecret);
    }

}